#! /usr/bin/python3
# coding = UTF-8
import random

class GuessWord(object):
    __words = ('python', 'jumble', 'easy', 'difficult',
         'answer', 'continue', 'phone', 'position', 'game')
    iscontinue = 'y'
    def __init__(self):
        self.__guess()
    def __getJumble(self, word):
        lw = list(word)
        random.shuffle(lw)
        return ''.join(lw)
    def __guess(self):
        while self.iscontinue.lower() == 'y':
            self.__word  = random.choice(self.__words)
            self.__correct = self.__word
            self.jumble = self.__getJumble(self.__word)
            print("""
                    欢迎参加猜单词游戏
                把字母组合成一个正确的单词
            """)
            print('乱序后的单词：',self.jumble)
            guess = input('\n请你猜：')
            while guess != self.__correct:
                print('对不起，不正确！')
                guess = input('\n继续猜：')
            if guess == self.__correct:
                print('猜对了，你真棒！')
            self.iscontinue = input('\n是否继续（Y/N）:')

guess = GuessWord()
